//
//  DDQuestionsRootTableViewCell.m
//  dingdang
//
//  Created by Chen Jing on 15-7-6.
//  Copyright (c) 2015年 阮 沧晖. All rights reserved.
//

#import "DDQuestionsRootTableViewCell.h"
#import "UFTextViewCustomToolbar.h"
@interface DDQuestionsRootTableViewCell ()
@property (weak, nonatomic) IBOutlet UIView *contentOfBody;
@property (weak, nonatomic) IBOutlet UIView *contentOfQuestionType;
@property (weak, nonatomic) IBOutlet UIView *contentOfRewardPoint;
@property (weak, nonatomic) IBOutlet UIView *contentOfSetAnswer;

@end

@implementation DDQuestionsRootTableViewCell

- (void)awakeFromNib {
    // Initialization code
    self.textView_body.layer.cornerRadius = 10;
    self.textView_body.layer.masksToBounds = YES;
    self.textView_body.layer.borderColor = [UIColor lightGrayColor].CGColor;
    self.textView_body.layer.borderWidth = .5;
    self.textView_body.placeholderColor = [UIColor lightGrayColor];
    self.textView_body.placeholder = @"请输入问题的文字描述";
    
    //UFTextViewCustomToolbar *customToolBar = [UFTextViewCustomToolbar new];
    //[RFKeyboardToolbar addToTextView:self.textView_body withButtons:@[customToolBar]];
}

-(void)clean{
    self.textView_body.text = @"";
    self.tf_rewardPoint.text = @"";
    self.imageView_body.image = nil;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (IBAction)btnOpenCamera:(id)sender {
    if (self.info_delegate) {
        if ([self.info_delegate respondsToSelector:@selector(openCamera)]) {
            [self.info_delegate performSelector:@selector(openCamera)];
        }
    }

}
- (IBAction)btnOpenPhotoLib:(id)sender {
    if (self.info_delegate) {
        if ([self.info_delegate respondsToSelector:@selector(openPhotoLib)]) {
            [self.info_delegate performSelector:@selector(openPhotoLib)];
        }
    }
}

-(void)fixCell{
    self.contentOfBody.hidden =
    self.contentOfQuestionType.hidden =
    self.contentOfRewardPoint.hidden =
    self.contentOfSetAnswer.hidden = YES;
    self.accessoryType = UITableViewCellAccessoryNone;
    if (self.info_thisCellType == cellType_questionType_body) {
        self.contentOfBody.hidden = NO;
//        if (self.imageView_body.image) {
//            self.contentOfBody.frame = CGRectMake(CGRectGetMinX(self.contentOfBody.frame),
//                                                  CGRectGetMinY(self.contentOfBody.frame),
//                                                  CGRectGetWidth(self.contentOfBody.frame),
//                                                  CGRectGetHeight(self.contentOfBody.frame) + 70);
//        }
    }else if (self.info_thisCellType == cellType_questionType_chooseQuestionType){
        self.contentOfQuestionType.hidden = NO;
        self.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    }else if (self.info_thisCellType == cellType_questionType_setAnswer){
        self.contentOfSetAnswer.hidden = NO;
        self.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
    }else if (self.info_thisCellType == cellType_questionType_setRewardPoint){
        self.contentOfRewardPoint.hidden = NO;
    }
    if (self.info_delegate) {
        self.textView_body.delegate = self.info_delegate;
    }
}



@end
